//
//  ViewController.m
//  UI_05homeWork
//
//  Created by dllo on 16/6/12.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "LabelButton.h"


@interface ViewController ()<LabelButtonDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatSubView];
}

-(void)creatSubView{
    LabelButton *button = [[LabelButton alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 100)];
    button.text = @"这其实是一个按钮";
    button.userInteractionEnabled = YES;
    button.backgroundColor = [UIColor colorWithRed:0.3 green:0.4 blue:0.5 alpha:1];
    [self.view addSubview:button];
    [button release];
    button.delegate = self;
}
-(void)touchBeginWith:(UIColor *)color{
    self.view.backgroundColor = [UIColor colorWithHue:arc4random() % 256 / 256+ 128 saturation:arc4random() % 128 / 256 + 0.5  brightness:arc4random() % 128 / 256 + 0.5 alpha:1];
}

-(void)touchDidEndWith:(CGRect)frame
{
    NSArray <LabelButton *>*subView = [self.view subviews];
    subView[0].frame = CGRectMake(0, 45, 280, 302);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
